import { ReqSearchList } from '@/api';
// 数据 状态
const state = {
  searchList: {},
};

//同步方法
const mutations = {
  SAVE_SEARCH_LIST(state, value) {
    state.searchList = value;
  },
};

//异步方法
const actions = {
  async asyncGetSearchList({ commit }, searchParams) {
    //调用获取 搜索结果的方法
    let data = await ReqSearchList(searchParams);
    //调用mutations 中的同步的方法更新state数据
    commit('SAVE_SEARCH_LIST', data);
  },
};

const getters = {};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters,
};
